import javax.naming.Context
import javax.naming.InitialContext

/**
 * Created by sxing on 14-10-2.
 */
class ConfigUtils {
    static Context initCtx
    static Context  envCtx

    static  Context getContext() {
        if (!initCtx) {
            initCtx = new InitialContext();
        }
        if (!envCtx) {
            envCtx = initCtx.lookup("java:comp/env");
        }
        return envCtx
    }
    static def getConfigFromJNDI(name) {
        Context envCtx =  getInitCtx()
        envCtx.lookup("admin")
    }
}
